package com.summer.framework.core.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.summer.framework.base.constant.DateFormatConstant;
import com.summer.framework.base.constant.FieldConstant;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * Description: 基础实体类
 * @auther Ice Yang
 * Date 2025/7/3 16:51
 */
@Getter
@Setter
public class BaseEntity {
    @TableId(value = FieldConstant.ID,type = IdType.AUTO)
    private Long id;

    @TableField(value = FieldConstant.CREATE_ID, fill = FieldFill.INSERT)
    private Long createId;

    @TableField(value = FieldConstant.CREATE_NAME, fill = FieldFill.INSERT)
    private String createName;

    @TableField(value = FieldConstant.CREATE_TIME, fill = FieldFill.INSERT)
    @JsonFormat(pattern = DateFormatConstant.DATE_TIME)
    private LocalDateTime createTime;

    @TableField(value = FieldConstant.UPDATE_ID, fill = FieldFill.INSERT_UPDATE)
    private Long updateId;

    @TableField(value = FieldConstant.UPDATE_NAME, fill = FieldFill.INSERT_UPDATE)
    private String updateName;

    @TableField(value = FieldConstant.UPDATE_TIME, fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = DateFormatConstant.DATE_TIME)
    private LocalDateTime updateTime;

    @TableLogic
    @TableField(FieldConstant.DELETED)
    private Integer deleted;
}
